<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>用户列表</title>
    <link rel="stylesheet" href="http://localhost:3000/static/bootstrap.min.css">
    <style>
        body {
            background-color: #ccc;
        }
        
        .btn {
            display: block;
            width: 10%;
            margin: 50px 0;
        }
    </style>
</head>

<body>
    <div class="container">
        <h6>
            <!-- <a href="/add" class="btn btn-primary" id="openDialog">添加用户</a> -->
            <a href="javascript:void(0)" class="btn btn-primary" id="openDialog">添加用户</a>
        </h6>
        <dialog id="myDialog">
            <h4>请添加用户信息</h4>
            <form action="http://localhost:5000/add" method="post">
                <div>
                    姓名: <input type="text" name="name">
                </div>
                <div>
                    年龄: <input type="text" name="age">
                </div>
                <div>如果有多项爱好请用空格隔开</div>
                <div>
                    爱好: <input type="text" name="hobbies">
                </div>
                <div>
                    email: <input type="text" name="email">
                </div>
                <div>
                    密码: <input type="password" name="password">
                </div>
                <input type="submit" value="提交">
            </form>
            <button id="closeDialog">关闭</button>
        </dialog>
        <table class="table table-striped table-bordered">
            <tr>
                <td>用户名</td>
                <td>年龄</td>
                <td>爱好</td>
                <td>邮箱</td>
                <td>操作</td>
            </tr>
            <tr>
                <td>用户名</td>
                <td>年龄</td>
                <td>爱好</td>
                <td>邮箱</td>
                <td>操作</td>
            </tr>
            <tr>
                <td>用户名</td>
                <td>年龄</td>
                <td>爱好</td>
                <td>邮箱</td>
                <td>操作</td>
            </tr>
            <tr>
                <td>用户名</td>
                <td>年龄</td>
                <td>爱好</td>
                <td>邮箱</td>
                <td>操作</td>
            </tr>
            <tr>
                <td>用户名</td>
                <td>年龄</td>
                <td>爱好</td>
                <td>邮箱</td>
                <td>操作</td>
            </tr>
        </table>
    </div>
    <script>
        const openDialog = document.getElementById('openDialog')
        const dialog = document.getElementById('myDialog')
        const closeDialog = document.getElementById('closeDialog')

        openDialog.addEventListener('click', () => {
            dialog.showModal()
        })

        closeDialog.addEventListener('click', () => {
            dialog.close()
        })
    </script>
</body>

</html>